]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
mixer-control: Check whether we are handling new device in sync_devices()
authorAlynx Zhou <alynx.zhou@gmail.com>
Fri, 30 Jan 2026 13:02:50 +0000 (21:02 +0800)
committerSimon McVittie <smcv@debian.org>
Mon, 9 Feb 2026 10:10:03 +0000 (10:10 +0000)
Previously sync_devices() is only called when there is a new device, but
with [1] we always call it, and create duplicated new devices. Fix it by
check whether we are handling new devices before creating.

[1]: https://gitlab.gnome.org/GNOME/libgnome-volume-control/-/commit/b9d0b120c6022cc2d1a728820a81beacc9360366

Bug: https://gitlab.gnome.org/GNOME/libgnome-volume-control/-/issues/39
Applied-upstream: gnome-shell 49.4, commit:d0e1664ac6278b70a7e26bf8135f0d1d92ee1e9f

Gbp-Pq: Topic libgvc
Gbp-Pq: Name mixer-control-Check-whether-we-are-handling-new-device-in.patch

subprojects/gvc/gvc-mixer-control.c

index a8c75a06287e35e459e44a9218827775b1463603..51e389fd55aaba6dc6e5ed98a6a0cb6e406f7ce2 100644 (file)
@@ -1336,6 +1336,7 @@ clear_stream_from_devices (GvcMixerControl    *control,
 static void
 sync_devices (GvcMixerControl *control,
               GvcMixerStream*  stream,
+              gboolean         is_new,
               gboolean         is_bluetooth)
 {
         /* Go through ports to see what outputs can be created. */
@@ -1350,7 +1351,7 @@ sync_devices (GvcMixerControl *control,
                 return;
         }
 
-        if (stream_ports == NULL) {
+        if (stream_ports == NULL && is_new) {
                 GvcMixerUIDevice *device;
                 GObject *object;
 
@@ -1547,7 +1548,7 @@ update_sink (GvcMixerControl    *control,
         is_bt = is_bluetooth (info->proplist);
         /* Sync devices as the port on the stream might have changed */
         if (!is_new)
-                sync_devices (control, stream, is_bt);
+                sync_devices (control, stream, is_new, is_bt);
 
         /* Messy I know but to set the port everytime regardless of whether it has changed will cost us a
          * port change notify signal which causes the frontend to resync.
@@ -1576,7 +1577,7 @@ update_sink (GvcMixerControl    *control,
                 add_stream (control, stream);
                 /* Always sync on a new stream to able to assign the right stream id
                  * to the appropriate outputs (multiple potential outputs per stream). */
-                sync_devices (control, stream, is_bt);
+                sync_devices (control, stream, is_new, is_bt);
         } else {
                 g_signal_emit (G_OBJECT (control),
                                signals[STREAM_CHANGED],
@@ -1685,7 +1686,7 @@ update_source (GvcMixerControl      *control,
         is_bt = is_bluetooth (info->proplist);
         /* Sync devices as the port on the stream might have changed */
         if (!is_new)
-                sync_devices (control, stream, is_bt);
+                sync_devices (control, stream, is_new, is_bt);
 
         if (info->active_port != NULL) {
                 if (is_new)
@@ -1707,7 +1708,7 @@ update_source (GvcMixerControl      *control,
                                      GUINT_TO_POINTER (info->index),
                                      g_object_ref (stream));
                 add_stream (control, stream);
-                sync_devices (control, stream, is_bt);
+                sync_devices (control, stream, is_new, is_bt);
         } else {
                 g_signal_emit (G_OBJECT (control),
                                signals[STREAM_CHANGED],